#include <stdio.h>
int main ()
{
	int i,n,a,b,c,max,x,mark=0;
	scanf("%d",&n);
	max=a>b-1?a:b-1;
	max=max>c-2?max:c-2;
	for(i=0;i<n;i++)
	{
	    scanf("%d %d %d",&a,&b,&c);
		if(!b%2)
		{
			if(a%2==0||c%2==0)   //b=even--->a=odd,c=odd,x=odd
			    printf("Impossible\n");
			else
			{
				if(a==c&&a!=1)
				    printf("Impossible\n");
				else
				{
				    for(x=max;x<=9999;x+=2)  
					    if(x%a==0&&(x+1)%b==0&&(x+2)%c==0)
					    {
					        printf("%d ",x);
					        mark=1;
					    }
					if(mark==0)
					    printf("Impossible\n");   
			        else
			            printf("\n");
				}	
	        }
	}
	    else
	    {
	    	for(x=max;x<=9999;x++)   //1w times circulation is no big deal
	    	    if(x%a==0&&(x+1)%b==0&&(x+2)%c==0)
	    	    {
	                 printf("%d ",x);
	    	         mark=1;
			    }
			if(mark==0)
		        printf("Impossible\n");
			else
			    printf("\n");   
			}
 } 
 } 
